package test2;

import java.io.PrintWriter;

import servlet.*;


public class ServletExample2 extends MyServlet {
	
	public void doGet(MyRequest request,MyResponse response){
		PrintWriter out = response.getWriter();
		MySession session = request.getMySession();
		String name = "zhu";
		session.setAttribute("name", name);
		
		out.println("<html>");
		out.println("<head>");
		out.println("<title>HTTP</title><script>function aa(){alert(\"button click\");}</script></head><body>");
		String[] names = request.getParaValues("name");
		if(names!=null){
			for(int i=0;i<names.length;i++){
				out.println("name:"+names[i]+"<br>");
			}
		}

		out.println("Hello HTTP!test2<br><img src=../img/a.gif><br>");
		out.println("<input type=\"button\" value=\"clickme\" onclick=\"aa()\"></body>");
		out.println("</html>");
		out.close();
		
	}

	public void doPost(MyRequest request,MyResponse response){
		doGet(request,response);
	}


}
